package com.shine.design.pattern.guide.factory;

/**
 * @Description: 在简单工厂模式中用于被创建实例的方法通常为静态(static)方法，
 * 因此简单工厂模式又被称为静态工厂方法
 * @CreateTime: 2023/8/27 13:29
 * @Version:
 * @Since: 1.8
 * @Author: Forward Seen
 */
public class ShapeFactory {
    public static Shape getShape(String shapeType) {
        if (shapeType == null) {
            return null;
        }
        if (shapeType.equalsIgnoreCase("CIRCLE")) {
            return new CircleShape();
        } else if (shapeType.equalsIgnoreCase("SQUARE")) {
            return new SquareShape();
        } else if (shapeType.equalsIgnoreCase("RECTANGLE")) {
            return new RectangleShape();
        }
        return null;
    }
}